package com.cy.pj.eiems.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cy.pj.eiems.Exception.ServiceException;
import com.cy.pj.eiems.dao.UserDao;
import com.cy.pj.eiems.service.UserService;


@Service
public class UserServiceImpl implements UserService{	
	@Autowired
	private UserDao userDao;
	
	@Override
	public String findUser(String username,String password) {
		String findUser = userDao.findUser(username);
//		System.out.println(findUser);
//		System.out.println(password);
//		System.out.println(password.equals(findUser));
		if (username==null) {
			throw new ServiceException("账号或密码错误11");
		} 
		if (password==null) {
			throw new ServiceException("账号或密码错误22");
		} 
		if(!password.equals(findUser))
			throw new ServiceException("账号或密码错误33");
		
		return "登录成功";
	}
	



}
